<!doctype html><html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        <div class="datalist"><table id="flexigrid" style="display:none"></table></div>
        <script type="text/javascript">
            $(function() {
                $("#flexigrid").flexigrid($.extend(SG.flexOptions, {
                    url: '<?= site_url('activity/activityad/flexigrid') ?>',
                    colModel: [
                        {display: '<?= translate('ACTIVITY_AD_ID') ?>', name: 'id', width: 80, iskey: true},
                        {display: '<?= translate('ACTIVITY_AD_NAME') ?>', name: 'adname', width: 150},
                        {display: '<?= translate('ACTIVITY_AD_SEQUENCE') ?>', name: 'sequence', width: 80},
                        {display: '<?= translate('ACTIVITY_AD_STATUS') ?>', name: 'status', width: 80},
                        {display: '<?= translate('ACTIVITY_AD_MANAGER') ?>', name: 'manager', width: 100},
                        {display: '<?= translate('ACTIVITY_AD_ADDTIME') ?>', name: 'addtime', width: 150},
                        {display: '<?= translate('MANAGE') ?>', name: 'id', width: 100, sortable: false, process: formatOp}
                    ],
                    buttons: [
						{name: 'add', displayname: "<?= translate('ADD') ?>", title: "<?= translate('ADD') ?>", bclass: 'add', onpress: multi},
						{name: 'export', displayname: "<?= translate('EXPORT') ?>", bclass: 'export', onpress: multi},
                        //{name: 'copyToOther', displayname: "<?= translate('COPY_TO_OTHER_AREA') ?>", title: "<?= translate('COPY_TO_OTHER_AREA') ?>", onpress:multi},
						//{name: 'copyToOther', displayname: "<?= translate('COPY_TO_OTHER_AREA') ?>", title: "<?= translate('COPY_TO_OTHER_AREA') ?>", onpress:toolbarItem},
                    ],
                    searchitems: true,
                }));
                SG.admin = $.extend(SG.admin, {
                	add_url: '<?= site_url("activity/activityad/add") ?>',
                    //edit_url: '<?= site_url("activity/activityad/edit/") ?>',
                    del_url: '<?= site_url("activity/activityad/del/") ?>',
                });

              //按钮操作函数     
              function toolbarItem(com, grid) {     
            	  var ids = $("#flexigrid").getCheckedRows();  
                  alert('com = '+com+" grid = "+grid+" ids = "+ids);      
                  if (com=='copyToOther'){          
                      if($('.trSelected',grid).length==0){           hiAlert("请选择要删除的数据!");             }
                      else{                hiConfirm('是否删除这 ' + $('.trSelected',grid).length + ' 条记录吗?', '操作提示', 
                              function(r)  {              
                          if(r){                 
                              var  ids ="";                     
                              $('.trSelected td:nth-child(2)',grid).each(function(){                     
                                  ids+=","+$(this).text();                    });                     
                              ids=ids.substring(1);                    
                              $.ajax({                 
                                  type: "POST",                  
                                  url: "<%=basePath %>admin/UserManagerServlet?action=delete",                         
                                  data: "ids="+ids, 
                                  dataType:"text",                  
                                  success: function(msg){                  
                                      if(msg=="success"){                   
                                          hiAlert("操作成功！");                     
                                          $("#JUserTable").flexReload();                   
                                          }else{                   
                                              hiAlert("有错误发生,msg="+msg);                   
                                              }                 
                                       },                  
                                       error: function(msg){                  hiAlert("msg="+msg);                 }                    
                                       });                     
                              }                 
                          });             
                      }              
                       }
              }
                
            });
        </script>       
    </body>
</html>